package com.net.xpay.core.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 2020/6/29 15:22

 */
public class EmailUtil {

    /**
     * 验证邮箱
     * @param email
     * @return
     */
    public static boolean checkEmail(String email){
        boolean flag;
        try{
            String check = "^[a-zA-Z\\d._-]*\\@[a-zA-Z\\d.-]+\\.[a-zA-Z\\d]{1,20}$";
            Pattern regex = Pattern.compile(check);
            Matcher matcher = regex.matcher(email);
            flag = matcher.matches();
        }catch(Exception e){
            flag = false;
        }
        return flag;
    }
}
